package com.xjwlmq.dx.servlet;

import com.alibaba.fastjson.JSON;
import com.xjwlmq.dx.dao.impl.MonitoringStationNameImpl;
import com.xjwlmq.dx.dao.impl.RainQualityImpl;
import com.xjwlmq.dx.entity.MonitoringStationName;
import com.xjwlmq.dx.entity.RainQuality;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

/**
 * @ClassName RainQualityListServlet
 * @Description TODO:
 * @Author 12994
 * @Date 2024/9/30 16:46
 * @Version 1.0
 **/
@WebServlet("/getStationNameList")
public class MonitoringStationNameListServlet extends HttpServlet {
    MonitoringStationNameImpl monitoringStationName = new MonitoringStationNameImpl();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html:charset=UTF-8");

        // 获得用户列表
        ArrayList<MonitoringStationName> monitoringStationNameArrayList = monitoringStationName.getMonitoringStationNameList();
        String stustr = JSON.toJSONString(monitoringStationNameArrayList);
        resp.getWriter().write(stustr);
    }
}
